﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Classes.util {
    import flash.events.*;
    import flash.utils.*;

    public class TimerUtil {

        public static function callLater(_arg1:Function, _arg2:int):Timer{
            var timer:* = null;
            var thunk:* = _arg1;
            var delayMs:* = _arg2;
            timer = new Timer(delayMs);
            timer.addEventListener(TimerEvent.TIMER, function (_arg1:TimerEvent):void{
                timer.removeEventListener(TimerEvent.TIMER, arguments.callee);
                timer.stop();
                timer = null;
                thunk();
            });
            timer.start();
            return (timer);
        }
        public static function callHandlerLater(_arg1:Function, _arg2:int):Timer{
            var timer:* = null;
            var thunk:* = _arg1;
            var delayMs:* = _arg2;
            timer = new Timer(delayMs);
            timer.addEventListener(TimerEvent.TIMER, function (_arg1:TimerEvent):void{
                timer.removeEventListener(TimerEvent.TIMER, arguments.callee);
                timer.stop();
                timer = null;
                thunk(_arg1);
            });
            timer.start();
            return (timer);
        }

    }
}//package Classes.util 
